package com.ruoyi.zhmk.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.zhmk.mapper.ZhmkDoorMapper;
import com.ruoyi.zhmk.domain.ZhmkDoor;
import com.ruoyi.zhmk.service.IZhmkDoorService;
import com.ruoyi.common.core.text.Convert;

/**
 * 门禁设备Service业务层处理
 * 
 * @author sxl
 * @date 2021-06-15
 */
@Service
public class ZhmkDoorServiceImpl implements IZhmkDoorService 
{
    @Autowired
    private ZhmkDoorMapper zhmkDoorMapper;

    /**
     * 查询门禁设备
     * 
     * @param doorId 门禁设备ID
     * @return 门禁设备
     */
    @Override
    public ZhmkDoor selectZhmkDoorById(Long doorId)
    {
        return zhmkDoorMapper.selectZhmkDoorById(doorId);
    }

    /**
     * 查询门禁设备列表
     * 
     * @param zhmkDoor 门禁设备
     * @return 门禁设备
     */
    @Override
    public List<ZhmkDoor> selectZhmkDoorList(ZhmkDoor zhmkDoor)
    {
        return zhmkDoorMapper.selectZhmkDoorList(zhmkDoor);
    }

    /**
     * 新增门禁设备
     * 
     * @param zhmkDoor 门禁设备
     * @return 结果
     */
    @Override
    public int insertZhmkDoor(ZhmkDoor zhmkDoor)
    {
        zhmkDoor.setCreateTime(DateUtils.getNowDate());
        return zhmkDoorMapper.insertZhmkDoor(zhmkDoor);
    }

    /**
     * 修改门禁设备
     * 
     * @param zhmkDoor 门禁设备
     * @return 结果
     */
    @Override
    public int updateZhmkDoor(ZhmkDoor zhmkDoor)
    {
        zhmkDoor.setUpdateTime(DateUtils.getNowDate());
        return zhmkDoorMapper.updateZhmkDoor(zhmkDoor);
    }

    /**
     * 删除门禁设备对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteZhmkDoorByIds(String ids)
    {
        return zhmkDoorMapper.deleteZhmkDoorByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除门禁设备信息
     * 
     * @param doorId 门禁设备ID
     * @return 结果
     */
    @Override
    public int deleteZhmkDoorById(Long doorId)
    {
        return zhmkDoorMapper.deleteZhmkDoorById(doorId);
    }
}
